<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
body>div {
	width: 200px;
	border: 1px solid red;
	/*  解决高度识别为零的问题  */
	overflow: hidden;
}

#d1 {
	width: 50px;
	height: 50px;
	background-color: black;
	float: left;
}

#d2 {
	width: 50px;
	height: 50px;
	background-color: red;
	float: left;
}

#d3 {
	width: 50px;
	height: 50px;
	background-color: yellow;
	float: left;
}
</style>
</head>
<body>
  <div>
    <div id="d1"></div>
    <div id="d2"></div>
    <div id="d3"></div>
  </div>
</body>
</html>